package com.gof.example.visitor;

import com.gof.example.utils.XmlUtil;
import org.xml.sax.SAXException;

import javax.xml.parsers.ParserConfigurationException;
import java.io.IOException;

/**
 * Created with IntelliJ IDEA.
 * Created by zhiyuan on 2018/5/11 18:07.
 * haiming.fei@tongdun.cn
 */
public class App {

    public static void main(String[] args) throws SAXException, IllegalAccessException, IOException, InstantiationException, ParserConfigurationException, ClassNotFoundException {
        Teacher teacher = new Teacher(20, 100, "曹操");
        Teacher teacher1 = new Teacher(12, 70, "荀彧");
        Teacher teacher2 = new Teacher(10, 95, "许攸");
        Teacher teacher3 = new Teacher(7, 80, "杨平");

        Student student = new Student(3, 91, "司马懿");
        Student student1 = new Student(3, 80, "杨修");
        Student student2 = new Student(1, 95, "曹丕");
        Student student3 = new Student(1, 80, "曹植");

        SchoolerList list = new SchoolerList();
        list.addSchooler(teacher);
        list.addSchooler(teacher1);
        list.addSchooler(teacher2);
        list.addSchooler(teacher3);
        list.addSchooler(student);
        list.addSchooler(student1);
        list.addSchooler(student2);
        list.addSchooler(student3);

//        ResearchAwardCheck researchAwardCheck = XmlUtil.getBean(ResearchAwardCheck.class);
        WelldoneAwardCheck welldoneAwardCheck = XmlUtil.getBean(WelldoneAwardCheck.class);
        for (Schooler s : list.getSchoolers()) {
            s.accept(welldoneAwardCheck);
        }
    }
}
